//
//  MHCircleInfoHeader.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/4/25.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHCircleInfoHeader.h"
#import "MHIMMessageTransferHelper.h"
#import <WZLBadge/WZLBadgeImport.h>

@implementation MHCircleInfoHeader


- (void)awakeFromNib
{
    [super awakeFromNib];
    self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.backgroundImageView.autoresizesSubviews = YES;
    self.backgroundImageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    self.backgroundImageView.masksToBounds = YES;
    self.myAvaterImage.layer.cornerRadius = 16.5;
    self.myAvaterImage.layer.masksToBounds = YES;
    self.ownerBtn.layer.cornerRadius = 70.0/2.0f;
    self.ownerBtn.layer.masksToBounds = YES;
    self.circleNameLable.font = MHSemiboldFont(20);
    self.circleDescLabel.font = MHRegularFont(13);
    self.infoContainer.cornerRadius = 8;
    self.infoContainer.masksToBounds = YES;
    self.locationBtn.titleLabel.font = MHRegularFont_10;
    UIVisualEffectView *effectView=[[UIVisualEffectView alloc]init];
    effectView.effect=[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    effectView.frame=self.backgroundImageView.bounds;
    effectView.alpha= 0.6;
    [self.backgroundImageView addSubview:effectView];
//    @weakify(self);
//    [RACObserve([MHIMMessageTransferHelper sharedInstance], unReadAuditMessage)
//     subscribeNext:^(NSNumber *x) {
//         @strongify(self);
//         [self.settingButton showBadgeWithStyle:WBadgeStyleRedDot value:[x integerValue] animationType:WBadgeAnimTypeNone];
//     }];
    
//    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
//    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
//    effectView.frame = CGRectMake(0, 0, self.backgroundImageView.frame.size.width*0.5, self.backgroundImageView.frame.size.height);
//    [self.backgroundImageView addSubview:effectView];
    [self.infoContainer addSubview:self.progress];
    self.progress.delegate = self;
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.progress.frame = CGRectMake(CGRectGetMaxX(self.infoContainer.frame) - 32 - 18 - 20, 18, 32, 32);
}

- (UIImageView *)backgroundImageView {
    return self.circleBgImageView;
}

-(void)progressViewOver:(MHProgressView *)progressView
{
    self.progress.hidden = YES;
}

-(MHProgressView *)progress
{
    if (!_progress) {
        _progress = [[MHProgressView alloc] init];
        _progress.hidden = YES;
        
    }
    return _progress;
}


@end
